<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增消息配置节点')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-node-add">
            <div class="form-group">
                <label class="col-sm-3 control-label">父消息节点：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="parentId" name="parentId" type="hidden" th:value="${sysNewsNode?.id}">
                        <input class="form-control" type="text" onclick="selectNodeTree()" id="treeName" readonly="true" th:value="${sysNewsNode?.newsNodeName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">消息节点：</label>
                <div class="col-sm-8">
                    <input name="newsNodeName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">节点key：</label>
                <div class="col-sm-8">
                    <input name="newsNodeKey" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">显示顺序：</label>
                <div class="col-sm-8">
                    <input name="orderNum" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/node"
        $("#form-node-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-node-add').serialize());
            }
        }

        /*消息配置节点-新增-选择父部门树*/
        function selectNodeTree() {
            var treeId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
            var options = {
                title: '消息配置节点选择',
                width: "380",
                url: prefix + "/selectNodeTree/" + treeId,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            console.log(body)
               $("#parentId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>